﻿/********************************************************************
* Copyright (C) 2012 iTouch, Inc (http://www.itouch.com.cn) 
* All rights reserved
* Created by ZhuDongDong <dongdong_82975389@163.com> at 2012-3-30 0:38:57

* 版权所有：浙大网新易盛网络通讯有限公司
* 文件名称：SerializerFactory
* 作    者：朱冬冬(dongdong_82975389@163.com)
* 创建时间：2012-3-30 0:38:57
* 说    明：
*
********************************************************************
$Id: SerializerFactory.cs 27 2012-03-30 01:26:20Z dongdong82975389@gmail.com $
$Rev: 27 $ 
$Author: dongdong82975389@gmail.com $ 
$Date: 2012-03-30 01:26:20 +0000 (Fri, 30 Mar 2012) $
*********************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IDb;

namespace Serialization
{
    /// <summary>
    /// 序列化简单工厂类
    /// </summary>
    public class SerializerFactory
    {
        /// <summary>
        /// 获一个指定格式的序列化器
        /// </summary>
        /// <param name="serializerType"></param>
        /// <returns></returns>
        public static ISerializer GetSerializer(SerializerStyle serializerType)
        {
            ISerializer serializer = null;
            switch (serializerType)
            {
                case SerializerStyle.Binary: serializer = new BinarySerializer(); break;
                case SerializerStyle.Json: serializer = new JsonSerializer(); break;
                case SerializerStyle.Xml: serializer = new XmlSerializer(); break;
            }
            return serializer;
        }
    }
}